# frozen_string_literal: true

module ConstantEnum
  def keys
    constants
  end

  def values
    keys.map { |key| const_get(key) }
  end

  def as_json
    keys.index_with { |key| const_get(key) }
  end

  def each_value
    values.each do |value|
      yield value
    end
  end
end
